<?php
/**
 * Created by PhpStorm.
 * User: ouryun
 * Date: 2021/5/12
 * Time: 9:29
 */

namespace app\api\controller;


use app\api\logic\VideoTimeLogic;
use think\admin\Controller;
use think\App;
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:GET, POST, OPTIONS');
header('Access-Control-Allow-Credentials:false');

class Config extends Controller
{
    protected $_datas;
    protected $_logic;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->_logic = new VideoTimeLogic();
    }

    /**
     * 获取轮播时间
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getConfigInfoAction()
    {
        $time = $this->_logic->getCarouselTime();
        if (empty($time)) {
            $time = 10;    //未设置默认给10分钟
        }
        $data = [
            'time' => $time,
            'monitor_num' => 9
        ];
        return returnJson(HTTP_CODE_SUCCESS, '成功', $data);
    }
}